package com.airsystem.pos.bengkel.entity;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * @author Fanny Irawan Sutawanir (fannyirawans@gmail.com)
 */

@Entity
@Table(name = "tbl_jenis_layanan")
public class JenisLayanan implements Serializable {

	@Transient
	public static final String ALIAS = "jenis_layanan";

	@Transient
	private int choice;

	@Id
	@GeneratedValue
	private Long id;

	private String nama;

	public String getSearchColumn() {
		StringBuffer sb = new StringBuffer();

		switch (choice) {
		case 0:
			return sb.append(JenisLayanan.ALIAS).append(".nama").toString();

		default:
			return sb.append(JenisLayanan.ALIAS).append(".nama").toString();
		}
	}

	public String getSearchKeyword() {
		switch (choice) {
		case 0:
			return getNama();

		default:
			return "";
		}
	}

	public int getChoice() {
		return choice;
	}

	public void setChoice(int choice) {
		this.choice = choice;
	}

	public String getId_s() {
		return (id == null) ? null : String.valueOf(id);
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getNama() {
		return nama;
	}

	public void setNama(String nama) {
		this.nama = nama;
	}
}